package com.studyyoun.android.nonghe.welcom.activity;
/**
 * Created by zhaolong on 2017/10/16.
 * 站在顶峰，看世界
 * 落在谷底，思人生
 */

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;

import com.studyyoun.android.androidcommonbaselibrary.activity.CommonBaseActivity;
import com.studyyoun.android.androidcommonbaselibrary.utils.SharedPreferencesUtil;
import com.studyyoun.android.nonghe.R;
import com.studyyoun.android.nonghe.home.activity.HomeActivity;
import com.studyyoun.android.nonghe.welcom.WelcomActivity;

/**
 * class infation
 */
public class StartActivity extends CommonBaseActivity {
    @Override
    protected void getAllIntentExtraDatas(Intent intent) {

    }

    @Override
    protected int getCommonLayoutId() {
        return R.layout.activity_start_layout;
    }

    @Override
    protected void commonInitView(View view) {

    }

    @Override
    protected void commonFunction() {

    }

    @Override
    protected void commonDelayFunction() {


        final String wisdomIsOne = SharedPreferencesUtil.getInstance(mContext).getData("wisdom_is_one");
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (TextUtils.isEmpty(wisdomIsOne)){
                    SharedPreferencesUtil.getInstance(mContext).saveData("wisdom_is_one","wisdom_is_one");
                    //startActivity(new Intent(StartActivity.this, WelcomActivity.class));
                    StartActivity.this.startActivity(new Intent(StartActivity.this, HomeActivity.class));
                    StartActivity.this.finish();
                }else {
                    StartActivity.this.startActivity(new Intent(StartActivity.this, HomeActivity.class));
                    StartActivity.this.finish();
                }
            }
        }, 2000);



    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mHandler.removeCallbacksAndMessages(0);
    }
}
